package com.xmtlxx.oms.domain.bo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Stream;

/**
 * 受托处置报表
 *
 * @author hergreen
 * @date 2024/10/14 14:42
 **/
@Data
@ApiModel("受托处置报表")
@NoArgsConstructor
@ExcelIgnoreUnannotated
@ColumnWidth(15)
public class AuthCenterDisposalBo {

    @ExcelProperty("区域")
    @ApiModelProperty("区域")
    private String region;

    @ExcelProperty({"涉案财物受托处置数量","已受托拍卖","车辆数量"})
    @ApiModelProperty("受托拍卖车辆数量")

    private Long auctionCarNumber;

    @ExcelProperty({"涉案财物受托处置数量","已受托拍卖","物品数量"})
    @ApiModelProperty("受托拍卖物品数量")
    private Long auctionGoodsNumber;

    @ExcelProperty({"涉案财物受托处置数量","已评估","车辆数量"})
    @ApiModelProperty("评估车辆数量")
    private Long evaluatedCarNumber;

    @ExcelProperty({"涉案财物受托处置数量","已评估","物品数量"})
    @ApiModelProperty("评估物品数量")
    private Long evaluatedGoodsNumber;

    @ExcelProperty({"涉案财物受托处置数量","已评估","评估金额"})
    @ApiModelProperty("评估金额")
    private BigDecimal evaluatedAmount;

    @ExcelProperty({"涉案财物受托处置数量","已拍卖","车辆数量"})
    @ApiModelProperty("已拍卖车辆数量")
    private Long auctionedCarNumber;

    @ExcelProperty({"涉案财物受托处置数量","已拍卖","物品数量"})
    @ApiModelProperty("已拍卖物品数量")
    private Long auctionedGoodsNumber;

    @ExcelProperty({"涉案财物受托处置数量","已拍卖","拍卖金额"})
    @ApiModelProperty("已拍卖金额")
    private BigDecimal auctionedAmount;

    @ExcelProperty({"涉案财物受托处置数量","返还","待返还数量"})
    @ApiModelProperty("待返还数量")
    private Long returnNumber;

    @ExcelProperty({"涉案财物受托处置数量","返还","已返还数量"})
    @ApiModelProperty("已返还数量")
    private Long returnedNumber;

    @ExcelProperty({"涉案财物受托处置数量","销毁","待销毁数量"})
    @ApiModelProperty("待销毁数量")
    private Long destroyNumber;

    @ExcelProperty({"涉案财物受托处置数量","销毁","已销毁数量"})
    @ApiModelProperty("已销毁数量")
    private Long destroyedNumber;

    public AuthCenterDisposalBo(List<AuthCenterDisposalBo> authCenterDisposals) {
        this.region = "合计";
        this.auctionCarNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getAuctionCarNumber).mapToLong(Long::longValue).sum();
        this.auctionGoodsNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getAuctionGoodsNumber).mapToLong(Long::longValue).sum();
        this.evaluatedCarNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getEvaluatedCarNumber).mapToLong(Long::longValue).sum();
        this.evaluatedGoodsNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getAuctionGoodsNumber).mapToLong(Long::longValue).sum();
        this.evaluatedAmount = authCenterDisposals.stream().map(AuthCenterDisposalBo::getEvaluatedAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        this.auctionedCarNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getAuctionedCarNumber).mapToLong(Long::longValue).sum();
        this.auctionedGoodsNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getAuctionedGoodsNumber).mapToLong(Long::longValue).sum();
        this.auctionedAmount = authCenterDisposals.stream().map(AuthCenterDisposalBo::getAuctionedAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        this.returnNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getReturnNumber).mapToLong(Long::longValue).sum();
        this.returnedNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getReturnedNumber).mapToLong(Long::longValue).sum();
        this.destroyNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getDestroyNumber).mapToLong(Long::longValue).sum();
        this.destroyedNumber = authCenterDisposals.stream().map(AuthCenterDisposalBo::getDestroyedNumber).mapToLong(Long::longValue).sum();
    }

}
